<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>流水号</title>
        <#include "/pubHeadStyle.html">
    </head>
    <body>
        <div style="width: 100%; ">
            <table class="layui-hide" id="serNumber" lay-filter="serNumber"></table>
        </div>
        <script type="text/html" id="serNumTool">
            <form class="layui-form" action="" style="margin-top:10px" lay-filter="identity">
                <div class="table-top-filter" style="position: relative">
                    <div class="table-filter-alone">
                        <label class="layui-form-label">名称</label>
                        <input type="text" name="Q_name_SL" id="identityName" class="layui-input filter-value"
                               autocomplete="off" placeholder="名称"/>
                    </div>
                </div>
                <a class="layui-btn layui-btn-sm" id="queryIdentity" lay-event="queryIdentity"
                   style="position: absolute;top: 5px;left: 292px;">
                    <i class="layui-icon layui-icon-search"></i>
                    <span>查询</span>
                </a>
                <a id="addIdentity" class="layui-btn layui-btn-sm" style="position: absolute;top:5px;right:248px">
                    <i class="layui-icon layui-icon-add-1"></i>
                    <span>添加</span>
                </a>
            </form>
        </script>
        <div class="layui-form-item" style="border:none">
            <div class="layui-input-block" style="margin:0;margin-top:11px;">
                <div class="layui-footer" style="background: #f2f2f2;text-align: center;">
                    <button type="button" class="layui-btn layui-btn-sm" id="chiose">选择</button>
                    <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="returnCol">取消</button>
                </div>
            </div>
        </div>
        <div class="addSer" hidden>
        </div>
        <script>
            layui.config({
                base: serverPath.formPath + staticPath.formPath //静态资源所在路径
            }).extend({
                index: 'index' //主入口模块
            }).use(['index', 'setter', 'form', 'layedit', 'laydate', 'jquery', 'common', 'table', 'layer', 'totalFilter'], function () {
                var form = layui.form, layer = layui.layer, totalFilter = layui.totalFilter;
                var table = layui.table;
                var $ = layui.$;
                var setter = layui.setter, common = layui.common;
                var index = parent.layer.getFrameIndex(window.name);
                $("#returnCol").on('click', function () {
                    parent.layer.close(index);
                });
                table.render({
                    elem: '#serNumber'
                    , url: serverPath.workflowPath + setter.workflowLinkPath + "identity/list"
                    , height: 'full-50'
                    , toolbar: '#serNumTool'
                    , defaultToolbar: ['filter', 'print']
                    , page: true
                    , cols: [[
                        {type: 'radio'}
                        ,{field: 'identityName', title: '名称', align: "center",templet:function (d) {
                                return d.identityName.replace(/</g,"&lt;").replace(/>/g,"&gt;");
                            }
                        }
                        , {field: 'alias', title: '别名', align: "center"}
                        , {field: 'rule', title: '规则', align: "center"}
                    ]]
                });
                totalFilter.init('serNumber');
                form.on('radio', function (data) {
                    var tr = $(this).closest('tr'), tds = tr.find('td')
                    var value = tds.eq(1).text();
                    var parentName = '${parentName}';
                    if (parentName != "" && parentName != "undefined") {
                        var ifr = window.parent.frames[parentName];
                        var win = ifr.window || ifr.contentWindow;
                        win.document.getElementById("identityName").value = value;
                    }
                });
                $("#chiose").on('click', function (data) {
                    parent.layer.close(index);
                });
                //头工具栏事件
                table.on('toolbar(serNumber)', function (obj) {
                    var checkStatus = table.checkStatus(obj.config.id);
                    var data = checkStatus.data; //获取选中行数据
                    switch (obj.event) {
                        case 'queryIdentity':
                            common.tableConditionRender("serNumber", "identity", {where: {}}, false);
                            break;
                    }
                });
                $(document).on('click', "#addIdentity", function () {
                    layer.open({
                        type: 2,
                        title: "添加流水号",
                        shade: 0.3,
                        area: ['700px', '450px'],
                        content: serverPath.workflowPath + setter.workflowLinkPath + "identity/view/add"
                    })
                })
            });
        </script>
        <style>
            #LAY_app {
                overflow: hidden;
            }
        </style>
    </body>
</html>